package 原型模式.深克隆;

import java.io.Serializable;

/**
 * @author wzx
 * @date 2024/9/5 16:51
 * @description: 具体原型类 实现 Cloneable 标识接口 表示当前类对象可复制
 */
public class ConcretePrototype implements Cloneable , Serializable {

    private Person person;

    public Person getPerson() {
        return person;
    }

    public void setPerson(Person person) {
        this.person = person;
    }

    public void show(){
        System.out.println("嫌疑人姓名："+person.getName());
    }

    public ConcretePrototype(){
        System.out.println("具体原型对象创建成功");
    }


    @Override
    protected ConcretePrototype clone() throws CloneNotSupportedException {
        System.out.println("克隆对象复制成功");
        return (ConcretePrototype)super.clone();
    }
}
